#pragma once

namespace fly
{
	namespace jld
	{
		namespace dp
		{
			template<typename T>
			class singleton
			{
			private:
				static T t_;
				//Prohibited copy
				singleton(const singleton&);
				const singleton& operator =(const singleton&);
			protected:
				singleton(){}
				virtual ~singleton(){}
			public:
				static T& instance()
				{
					return t_;
				}

			};

			//class T should be 'friend class singleton<T>'
			template<typename T>
			T singleton<T>::t_ = T();

		}
	}
}